package it.marcelate.rcp.jdtutil.ui.actions;

import org.eclipse.jdt.core.ICompilationUnit;
import org.eclipse.jdt.ui.IWorkingCopyManager;
import org.eclipse.jdt.ui.JavaUI;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.ui.IEditorActionDelegate;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.IWorkbenchWindow;


/**
 * 
 * @author demarcom
 *
 * @see http://www.jdg2e.com/ch27.jdt/doc/index.html (The Java Developers Guide to Eclipse # ch. 27)
 * @see http://www.jdg2e.com/jdg2e_CD_for_eclipse321.zip (download examples)
 *
 *
 */

public class FindAndReplaceMethodEditorAction extends FindAndReplaceMethodBaseAction implements IEditorActionDelegate {

  private ICompilationUnit unit;
  
  @Override
  public void run(IAction action) {
    super.processCompilationUnit(unit);
  }
  
  @Override
  public void setActiveEditor(IAction action, IEditorPart targetEditor) {
    IWorkingCopyManager manager = JavaUI.getWorkingCopyManager();
    this.unit = manager.getWorkingCopy(targetEditor.getEditorInput());
  }

  @Override
  public void selectionChanged(IAction action, ISelection selection) {
      
  }

  @Override
  public void dispose() {

  }

  @Override
  public void init(IWorkbenchWindow window) {

  }

}
